﻿#pragma once

#include <QtWidgets/QWidget>
#include "ui_TcpClient.h"
#include <QFile>
#include <QTcpSocket>
#include <qiodevice.h>
#include "protocol.h"
#include "OpeWidget.h"

namespace Ui {
	class TcpClient;
}

class TcpClient : public QWidget
{
	Q_OBJECT
public:
	TcpClient(QWidget* parent = nullptr);
	~TcpClient();

	void loadConfig();
	static TcpClient& getInstance();
	QTcpSocket& getTcpSocket();

	QString getCurPath();
	void setCurPath(QString);
	QString getStrName();
	bool getDownloadState();
	void setDownloadState(bool state);

signals:

public slots:
	void showConnect();
	void recvMsg();

private slots:

	void on_login_pb_clicked();

	void on_regist_pb_clicked();

	void on_cancel_pb_clicked();

private:
	Ui::TcpClientClass ui;
	//每个TcpClient类有一个私有的IP
	QString m_strIP;
	//每个TcpClient类有一个私有的端口号
	quint16 m_usPort;
	//每个TcpClient类有一个私有的QTcpSocket对象
	QTcpSocket m_tcpSocket;
	//记录当前所在文件夹路径
	QString m_strCurPath;
	bool m_bDownloadFile;	//标识是否是下载文件状态

	/*****VIP*****/
	QString strName;
	/*****VIP*****/
};
